package com.ruoyi.project.order.service;

import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.order.domain.Order;
import com.ruoyi.project.order.mapper.OrderMapper;
import com.ruoyi.project.system.post.domain.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderRemoveServiceImpl implements IOrderRemoveService {
    @Autowired
    private OrderMapper orderMapper;

    /**
     * 删除订单信息，批量删除时，参数中用逗号隔开
     * @param ids
     * @return
     */

    @Override
    public int deleteOrderByIds(String ids)  throws BusinessException{
        {
            Long[] orderIds = Convert.toLongArray(ids);
            /*for (Long orderId : orderIds)
            {
                Order order = orderMapper.selectOrderByOrderId(orderId);
                if (countUserPostById(orderId) > 0)
                {
                    throw new BusinessException(String.format("%1$s已分配,不能删除", order.getOrderName()));
                }
            }*/
            return orderMapper.deleteOrderByIds(orderIds);
        }
    }
}
